//
//  UISearchBar.swift
//  CMKit
//
//  Created by travel on 2016/12/16.
//  Copyright © 2016年 covermedia. All rights reserved.
//

import UIKit

public extension UISearchBar {
    
    /// 隐藏边框
    public func hideBoarder() {
        self.backgroundImage = UIImage.init()
    }
    
    
    /// 设置取消按钮标题
    ///
    /// - Parameter title: 标题
    public func setCancelButton(title:String) {
        for subview in subviews{
            if let button = subview as? UIButton {
                button.setTitle(title, for: UIControlState())
                return
            } else {
                for subview1 in subview.subviews {
                    if let button = subview1 as? UIButton  {
                        button.setTitle(title, for: UIControlState())
                        return
                    }
                }
            }
        }
    }
}
